package com.wlyuan.open.scanner.application.handler.full;

import com.wlyuan.open.dto.OpenDriverSyncDTO;
import com.wlyuan.open.scanner.application.annotation.ScannerCode;
import com.wlyuan.open.scanner.assembler.ScannerDriverAssembler;
import com.wlyuan.open.scanner.constant.ScannerCodeEnum;
import com.wlyuan.open.scanner.domain.driver.Driver;
import com.wlyuan.open.scanner.repository.DriverRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lijing
 * @description
 */
@ScannerCode(code = ScannerCodeEnum.DRIVER)
@Service
@Slf4j
@RequiredArgsConstructor
public class ScannerDriverHandler extends BaseScannerHandler<Driver, OpenDriverSyncDTO> {
    private final DriverRepository driverRepository;

    @Override
    protected List<Driver> select() {
        return driverRepository.list();
    }

    @Override
    protected List<OpenDriverSyncDTO> assembler(List<Driver> data) {
        return ScannerDriverAssembler.assemble(data);
    }

}
